@using BlazorApp.Pages.Common.Html
@using k8s
@inherits BlazorApp.Pages.Common.PageBase

@if (Ports != null)
{
    <HTableColumn Title=@L["Ports"] ExplainField="service.spec.ports">
        @foreach (var p in Ports)
        {
            <div>
                @($"{p.Name}:{p.Port}/{p.Protocol} ")
                @if (p.NodePort != null)
                {
                    <Tag Color="success">@p.NodePort</Tag>
                }
                @if (p.AppProtocol != null)
                {
                    <Tag Color="@PresetColor.Blue.ToString()">@p.AppProtocol</Tag>
                }

                @if (SvcName != null && SvcNamespace != null)
                {
                    @if (!KubernetesClientConfiguration.IsInCluster())
                    {
                        <Button Type="@ButtonType.Primary" OnClick="@(() => Forward(p))">Forward</Button>
                    }
                }
            </div>
        }
    </HTableColumn>
}
